const state = {
    data: ['ok', 'go'],
    length: 2
};

const getters = {
    result: (state, getters, rootState) => {
        return state.data[rootState.data.count % state.length];
    },
    isShow: (state, getters, rootState) => {
        return rootState.data.count > 0;
    }
};

const actions = {
    add({ commit }, param){
        commit('add', param);
    }
}

const mutations = {
    add(state, param){
        state.data.push(param);
        state.length = state.data.length;
    }
}

export default {
    namespaced: true,
    state,
    getters,
    actions,
    mutations
}